#ifndef SYSTEM_SDL_1_3_H
#define SYSTEM_SDL_1_3_H

//
//  FORWARD DECLS
//
class CMain;
class CMainWindowSDL_1_3;
class CWindowSDL_1_3;
class CTextureSDL_1_3;
class CSystemSDL_1_3_Renderer;
class CPoint;
class CColor;
class CRect;

typedef class CSystemSDL_1_3
{
        //
        //  CTOR AND DTOR
        //  unimplemented for a reason
        CSystemSDL_1_3( void );
        CSystemSDL_1_3( const CSystemSDL_1_3& sys );
        CSystemSDL_1_3 operator=( const CSystemSDL_1_3& sys );
        ~CSystemSDL_1_3( void );

static  int Init( void );
static  int Process( void );
static  void Update( void );
static  void ShutDown( void );
static  const char* GetError( void );

static  bool                m_isRunning;

friend  class CMain;
friend  class CSystemSDL_1_3_Main;

} CSystem;

//
//  FORWARD DECLS
//
struct SDL_Window;
struct SDL_Renderer;
struct SDL_Surface;
struct SDL_Texture;
union SDL_Event;

typedef class CSystemSDL_1_3_Main
{
        //
        //  CTORS AND DTOR
        //  unimplemented for a reason
        //
        CSystemSDL_1_3_Main( void );
        CSystemSDL_1_3_Main( const CSystemSDL_1_3_Main& sysMain );
        CSystemSDL_1_3_Main operator=( const CSystemSDL_1_3_Main& sysMain );
        ~CSystemSDL_1_3_Main( void );

static  int Init( void );
static  int ProcessEvents( void );
static  void ShutDown( void );
static  void Quit( void );

static  SDL_Window*         m_hFocusWnd;
static  CWindowSDL_1_3*     m_pFocusWnd;
static  CMainWindowSDL_1_3* m_pMainWnd;
static  const char           WINDOW_PTR_NAME[];

        //
        //  FRIEND CLASSES
        //
friend  class CSystemSDL_1_3;
friend  class CWindowSDL_1_3;
friend  class CTextureSDL_1_3;
} CSystemMain;

typedef class CSystemSDL_1_3_Renderer
{
        //
        //  CTORS AND DTOR
        //  unimplemented for a reason
        //
        CSystemSDL_1_3_Renderer( void );
        CSystemSDL_1_3_Renderer( const CSystemSDL_1_3_Renderer& sysRenderer );
        CSystemSDL_1_3_Renderer operator=( const CSystemSDL_1_3_Renderer& sysRenderer );
        ~CSystemSDL_1_3_Renderer( void );

        //
        //  SDL WRAPPER METHODS
        //
    public:
static  int SetRenderColor( unsigned char red, unsigned char green, unsigned char blue,
                            unsigned char alpha );
static  int SetRenderColor( const CColor& color );
static  int DrawPoint( const CPoint& pt );
static  int DrawPoint( const CPoint& pt, const CColor& color );
static  int DrawPoints( const CPoint* ppts, int count );
static  int DrawPoints( const CPoint* ppts, int count, const CColor& color );
static  int DrawLine( const CPoint& begin, const CPoint& end );
static  int DrawLine( const CPoint& begin, const CPoint& end, const CColor& color );
static  int DrawLines( const CPoint* ppts, int count );
static  int DrawLines( const CPoint* ppts, int count, const CColor& color );
static  int DrawRect( const CRect& rect );
static  int DrawRect( const CRect& rect, const CColor& color );
static  int DrawRects( const CRect* prects, int count );
static  int DrawRects( const CRect* prects, int count, const CColor& color );
static  int DrawFilledRect( const CRect& rect );
static  int DrawFilledRect( const CRect& rect, const CColor& color );
static  int DrawFilledRects( const CRect* prects, int count );
static  int DrawFilledRects( const CRect* prects, int count, const CColor& color );
static  int DrawEllipse( const CPoint& origin, int radius );
static  int DrawEllipse( const CPoint& origin, int radius, const CColor& color );
static  int DrawFilledEllipse( const CPoint& origin, int radius );
static  int DrawFilledEllipse( const CPoint& origin, int radius, const CColor& color );
    private:
static  SDL_Renderer*    m_hCurrentRenderer;

static  int Draw4Points( const CPoint& origin, int dx, int dy );
static  int Draw4Points( const CPoint& origin, int dx, int dy, const CColor& color );
static  int Draw8Points( const CPoint& origin, int dx, int dy );
static  int Draw8Points( const CPoint& origin, int dx, int dy, const CColor& color );
static  int Draw4Lines( const CPoint& origin, int dx, int dy, const CColor& color );
static  int Draw4Lines( const CPoint& origin, int dx, int dy );
static  int Draw8Lines( const CPoint& origin, int dx, int dy, const CColor& color );
static  int Draw8Lines( const CPoint& origin, int dx, int dy );

        //
        //  FRIEND CLASSES
        //
friend  class CSystemSDL_1_3_Main;
friend  class CTextureSDL_1_3;
friend  class CWindowSDL_1_3;
} CSystemRenderer;

typedef class CSystemSDL_1_3_Helper
{
        //
        //  CTORS AND DTOR
        //  unimplemented for a reason
        //
        CSystemSDL_1_3_Helper( void );
        CSystemSDL_1_3_Helper( const CSystemSDL_1_3_Helper& sysHelper );
        CSystemSDL_1_3_Helper operator=( const CSystemSDL_1_3_Helper& sysHelper );
        ~CSystemSDL_1_3_Helper( void );

static  void SetError( const char* error, ... );
static  void PrintRenderer( SDL_Renderer* rnd );
static  void PrintSurface( SDL_Surface* surf );
static  void PrintEvent( const SDL_Event& ev );
static  const char* PixelFormatToString( const unsigned int flags );
static  const char* EventFlagToString( const unsigned int flags );
static  const char* MouseButtonToString( const unsigned int flags );
static  const char* IsPressedToString( const unsigned int flags );

//
//  System message members and methods
//
static  void ResetSysMessage( void );           // resets the sys message array
static  void SysMessageCat( const char* msg );  // concatenates a string the the sys message array

static  const int       MAX_ARRAY_LENGTH = 1028;
static  char            m_SysMessage[MAX_ARRAY_LENGTH];
static  char            m_SysErrorMessage[MAX_ARRAY_LENGTH];
static  char*           m_pCurrentPos;          // cursor position in the sys message array

        //
        // FRIEND CLASSES
        //
friend  class CSystemSDL_1_3;
friend  class CSystemSDL_1_3_Main;
friend  class CWindowSDL_1_3;
friend  class CMainWindowSDL_1_3;
friend  class CTextureSDL_1_3;
} CSystemHelper;

#endif // SYSTEM_SDL_1_3_H
